package connector

import (
	"gateway/config"
	"gateway/core"
	"go.uber.org/zap"
)

const (
	PORT        = "port"
	ROOT_PATH   = "/"
	PATH        = "path"
	METHOD      = "method"
	HTTP_METHOD = "httpMethod"
	HTTP_URL    = "httpUrl"
)

func getConnectorFunc(name string) func(string) core.Connector {
	switch name {
	case "httpConnector":
		return newHttpConnector
	default:
		return nil
	}
}

func NewConnector(name string) core.Connector {
	f := getConnectorFunc(name)
	if f == nil {
		config.Logger.Panic("Connector not found", zap.String("name", name))
	}
	return f(name)
}
